const mysql = require('mysql2');
//连接池
const connection = mysql.createPool({
    host: 'localhost',
    user: 'root',
    password: 'lishixue2003',
    database: 'github',
    port: 3306,
    connectionLimit: 10
});

 connection.getConnection(function (err, connection) {
     if (err) {
         console.log('数据库连接失败');
         return;
     }
     console.log('数据库连接成功');
 });
module.exports = connection.promise(); //返回一个promise对象